package com.runen.infinitemovement.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;
import com.runen.infinitemovement.model.entity.MyLegionInfoEntity;
import com.runen.infinitemovement.tool.GlideUtils;
import com.runen.infinitemovement.widget.imageview.RoundedCornersImage;

/**
 * Create by LiaoDuanHong
 * Create on
 */
public class MyTeamAdapter extends BaseQuickAdapter<MyLegionInfoEntity.DataBean.TenantListBean, BaseViewHolder> {
    private Context context;
    public MyTeamAdapter(Context context) {
        super(R.layout.item_my_team);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, MyLegionInfoEntity.DataBean.TenantListBean bean) {
        LinearLayout ll_normal = baseViewHolder.findView(R.id.ll_normal);
        LinearLayout ll_yaoqing = baseViewHolder.findView(R.id.ll_yaoqing);
        RoundedCornersImage header = baseViewHolder.findView(R.id.rci_header);
        TextView tv_name = baseViewHolder.findView(R.id.tv_name);
        if (TextUtils.isEmpty(bean.tenantName)) {
            ll_yaoqing.setVisibility(View.VISIBLE);
            ll_normal.setVisibility(View.GONE);
        } else {
            ll_yaoqing.setVisibility(View.GONE);
            ll_normal.setVisibility(View.VISIBLE);
            if (!TextUtils.isEmpty(bean.logo)) {
                GlideUtils.loadImage(context, bean.logo, header);
            }
            tv_name.setText(bean.tenantName);
        }

    }
}
